package com.mangrove;

import android.app.Activity;
import android.content.Intent;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.os.Bundle;
import android.widget.Button;
import android.widget.Toast;

public class Login extends Activity {
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.login);
        
        OnClickListener handlLogin = new Button.OnClickListener() {
        	public void onClick(View v){
        		Intent loginIntent = new Intent(Login.this,MainPanel.class);
        		Login.this.startActivity(loginIntent);
        		Login.this.finish();
        	}
        };
        
        findViewById(R.id.Button_Login).setOnClickListener(handlLogin);
        findViewById(R.id.Button_NewAccount).setOnClickListener(handlLogin);
        
    }

	@Override
	public boolean onCreateOptionsMenu(Menu menu){
		Log.v("Menu","Option Menu Create");
		MenuInflater inf = getMenuInflater();
		inf.inflate(R.menu.login_menu, menu);
		return true;
	}
	
	@Override
	public boolean onPrepareOptionsMenu(Menu menu){
		Log.v("Menu","Prepare Menu Call");
		return true;
	}
	
	@Override
	public boolean onOptionsItemSelected(MenuItem item){
		Log.v("Menu",item.toString());
		switch (item.getItemId())
		{
		case R.id.clear_account:
			return true;
		case R.id.setting:
			Toast.makeText(this, "setting it or not?", 1000).show();
			return true;
		case R.id.about:
			return true;
		case R.id.exit:
		{
			ApplicationManager.exitApplication(this);
			return true;
		}
		default:
			return super.onOptionsItemSelected(item);	
		}
	}
}
